package com.yykj.backstage.all.controller;

import com.yykj.common.vo.PageData;
import com.yykj.common.vo.ResultVO;
import com.yykj.hospital.client.dto.bank.DoctorBankCashApplyDTO;
import com.yykj.hospital.client.feign.HospitalServerFeignClient;
import com.yykj.hospital.client.form.bank.CashApplyCheckForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/backstage/doctor/cash/apply")
@Api(tags = "总后台--医生提现相关接口")
@SuppressWarnings(value = "unchecked")
public class DoctorCashApplyController {
    @ApiOperation("提现申请--审核拒绝")
    @PostMapping("/refused")
    public ResultVO refuseDoctorCashApply(@RequestBody CashApplyCheckForm form){
        hospitalServerFeignClient.refuseDoctorCashApply(form);
        return ResultVO.success();
    }


    @ApiOperation("提现申请 -- 审核通过")
    @PostMapping("/pass")
    public ResultVO passDoctorCashApply(@RequestBody CashApplyCheckForm form){
        hospitalServerFeignClient.passDoctorCashApply(form);
        return ResultVO.success();
    }
    @ApiOperation("提现申请 -- 列表 ")
    @GetMapping("/list")
    public ResultVO<PageData<DoctorBankCashApplyDTO>> listDoctorCashApply(@RequestParam(name = "orderNo",required = false) String orderNo,
                                                                @RequestParam(name = "hospitalId" ,required = false) Integer hospitalId,
                                                                @RequestParam(name = "doctorId",required = false) String doctorId,
                                                                @RequestParam(name = "doctorName",required = false) String doctorName,
                                                                @RequestParam(name = "bankCardNo",required = false) String bankCardNo,
                                                                @RequestParam(name = "startTime",required = false) String startTime,
                                                                @RequestParam(name = "endTime",required = false) String endTime,
                                                                @RequestParam(name = "status",required = false) Integer status,
                                                                @RequestParam(name = "currentPage",defaultValue = "1") Integer currentPage,
                                                                @RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize ){
        PageData<DoctorBankCashApplyDTO> list = hospitalServerFeignClient.listDoctorCashApply(orderNo,
                hospitalId,
                doctorId,
                doctorName,
                bankCardNo,
                startTime,
                endTime,
                status,
                currentPage,
                pageSize);
        return ResultVO.success(list);
    }
    private HospitalServerFeignClient hospitalServerFeignClient;

    @Autowired
    public void setHospitalServerFeignClient(HospitalServerFeignClient hospitalServerFeignClient) {
        this.hospitalServerFeignClient = hospitalServerFeignClient;
    }
}
